package com.itheima.d7_threadpool2;

import java.util.concurrent.Callable;

public class MyCallable implements Callable<String> {
    private int n ;
    public MyCallable(int n) {
        this.n = n;
    }
    @Override
    public String call() throws Exception {
        //求1-n的和
        int sum  = 0;
        for (int i = 0; i < n ; i++) {
            sum += i;
        }
        return Thread.currentThread().getName()+"计算1-"+ n +"的和为："+ sum;
    }
}
